<html>
<head><meta charset="utf-8"><title>fn ptr in static · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html">fn ptr in static</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="148120551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120551">(Nov 21 2018 at 16:19)</a>:</h4>
<p>I have this type:</p>
<div class="codehilite"><pre><span></span>pub struct PanicOutput&lt;W: Write&gt;(pub Option&lt;fn() -&gt; io::Result&lt;W&gt;&gt;);
</pre></div>



<a name="148120579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120579">(Nov 21 2018 at 16:19)</a>:</h4>
<p>when I try to store it in a const or static, I get this error:</p>
<div class="codehilite"><pre><span></span>80 | pub static PANIC_OUTPUT: PanicOutput&lt;Stderr&gt; =  PanicOutput(Some(Stderr::new));
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected something that cannot possibly be outside the (wrapping) range 1..=0
   |
   = note: The rules on what exactly is undefined behavior aren&#39;t clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
</pre></div>



<a name="148120589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120589">(Nov 21 2018 at 16:19)</a>:</h4>
<p>I'm not sure I understand what's going on. can you not store fn pointers in a static?</p>



<a name="148120736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120736">(Nov 21 2018 at 16:22)</a>:</h4>
<p><span class="user-mention" data-user-id="138938">@Jethro</span> which rustc version? have you tried nightly?</p>



<a name="148120741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120741">(Nov 21 2018 at 16:22)</a>:</h4>
<p>I recall fixing something similar recently</p>



<a name="148120753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120753">(Nov 21 2018 at 16:22)</a>:</h4>
<p>how can I have x.py output the compiler version it's using?</p>



<a name="148120778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120778">(Nov 21 2018 at 16:23)</a>:</h4>
<p>oh you are doing this in rustc?</p>



<a name="148120787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120787">(Nov 21 2018 at 16:23)</a>:</h4>
<p>then it is using the bootstrap compiler, which is a beta</p>



<a name="148120804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120804">(Nov 21 2018 at 16:23)</a>:</h4>
<div class="codehilite"><pre><span></span>build/x86_64-unknown-linux-gnu/stage0/bin/rustc --version
</pre></div>


<p>would show the version</p>



<a name="148120848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120848">(Nov 21 2018 at 16:24)</a>:</h4>
<p>but yeah, possible that the fix didn't make it into beta yet</p>



<a name="148120862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120862">(Nov 21 2018 at 16:24)</a>:</h4>
<p>ah yeah it's rustc 1.31.0-beta.1 (2824a67b0 2018-10-29)</p>



<a name="148120872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120872">(Nov 21 2018 at 16:24)</a>:</h4>
<p>how critical is this? I guess we could try to get it backported</p>



<a name="148120875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120875">(Nov 21 2018 at 16:24)</a>:</h4>
<p>so um.. if I want to do this in std, what are my options? wait until bootstrap is fixed?</p>



<a name="148120892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120892">(Nov 21 2018 at 16:25)</a>:</h4>
<p>you can also use <code>#[cfg(not(stage0))]</code></p>



<a name="148120916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120916">(Nov 21 2018 at 16:25)</a>:</h4>
<p>except I'm changing existing code</p>



<a name="148120922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120922">(Nov 21 2018 at 16:25)</a>:</h4>
<p>but all uses of the static will also need the cfg</p>



<a name="148120925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120925">(Nov 21 2018 at 16:25)</a>:</h4>
<p>yea, you'd need to keep the old code around, too</p>



<a name="148120937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148120937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148120937">(Nov 21 2018 at 16:25)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@Oli</span> hm why does <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2015&amp;gist=1840f8bef870ba3faa6085455f3a882c" target="_blank" title="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2015&amp;gist=1840f8bef870ba3faa6085455f3a882c">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2015&amp;gist=1840f8bef870ba3faa6085455f3a882c</a> work?</p>



<a name="148121000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121000">(Nov 21 2018 at 16:26)</a>:</h4>
<p>why should it not work?</p>



<a name="148121009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121009">(Nov 21 2018 at 16:26)</a>:</h4>
<p>function pointers in constants are fine</p>



<a name="148121012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121012">(Nov 21 2018 at 16:26)</a>:</h4>
<p>and have been since 1.0</p>



<a name="148121018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121018">(Nov 21 2018 at 16:26)</a>:</h4>
<p>right but this is the bug where we dont know that fn pointers are non-NULL</p>



<a name="148121039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121039">(Nov 21 2018 at 16:27)</a>:</h4>
<p>isn't <code>fn()</code> a function <em>reference</em>?</p>



<a name="148121045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121045">(Nov 21 2018 at 16:27)</a>:</h4>
<p>although we always say "pointer"</p>



<a name="148121058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121058">(Nov 21 2018 at 16:27)</a>:</h4>
<p><em>shrug</em> I use these terms rather interchangeably</p>



<a name="148121067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121067">(Nov 21 2018 at 16:27)</a>:</h4>
<p>right, as do I, but Rust makes a difference between the two ;-)</p>



<a name="148121076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121076">(Nov 21 2018 at 16:27)</a>:</h4>
<p>uh... maybe it's related to the newtype around the option?</p>



<a name="148121077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121077">(Nov 21 2018 at 16:27)</a>:</h4>
<p>I don't know if it makes sense to distinguish for fn ptrs</p>



<a name="148121126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121126">(Nov 21 2018 at 16:28)</a>:</h4>
<p>there is no meaningful semantic difference (except if you want to say non-NULL is the difference)</p>



<a name="148121134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121134">(Nov 21 2018 at 16:28)</a>:</h4>
<p>a function pointer cannot be null</p>



<a name="148121140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121140">(Nov 21 2018 at 16:28)</a>:</h4>
<p><span class="user-mention" data-user-id="138938">@Jethro</span> I feel like that... is a huge semantic difference...</p>



<a name="148121142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121142">(Nov 21 2018 at 16:28)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@Oli</span> this also works on playground:</p>
<div class="codehilite"><pre><span></span>fn a() {} struct A&lt;T&gt;(Option&lt;fn() -&gt; T&gt;); const X: A&lt;()&gt; = A(Some(a));
</pre></div>



<a name="148121151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121151">(Nov 21 2018 at 16:29)</a>:</h4>
<p>I guess you need a more pathological case to trigger the UB warning</p>



<a name="148121161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121161">(Nov 21 2018 at 16:29)</a>:</h4>
<p>I think it was just broken in a few rustc versions</p>



<a name="148121168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121168">(Nov 21 2018 at 16:29)</a>:</h4>
<p>oh play is using a much newer beta than bootstrap</p>



<a name="148121169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121169">(Nov 21 2018 at 16:29)</a>:</h4>
<p>but apparently one that made it into a specific beta, but not the nightly beta?</p>



<a name="148121178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121178">(Nov 21 2018 at 16:29)</a>:</h4>
<p>we probably backported it ;)</p>



<a name="148121190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121190">(Nov 21 2018 at 16:29)</a>:</h4>
<p>maybe you can get away with bumping the bootstrap compiler</p>



<a name="148121191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121191">(Nov 21 2018 at 16:29)</a>:</h4>
<p>1.31.0-beta.1 vs 1.31.0-beta.15</p>



<a name="148121253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121253">(Nov 21 2018 at 16:30)</a>:</h4>
<p>you could probably upgrade the beta release without much objection</p>



<a name="148121273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121273">(Nov 21 2018 at 16:30)</a>:</h4>
<p>any pointers for this?</p>



<a name="148121276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121276">(Nov 21 2018 at 16:30)</a>:</h4>
<p>err, the bootstrap beta. I'm a little surprised it doesn't happen "automatically", but it's probably only when needed</p>



<a name="148121303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121303">(Nov 21 2018 at 16:31)</a>:</h4>
<p>I'd skim <a href="https://forge.rust-lang.org/release-process.html" target="_blank" title="https://forge.rust-lang.org/release-process.html">https://forge.rust-lang.org/release-process.html</a></p>



<a name="148121317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121317">(Nov 21 2018 at 16:31)</a>:</h4>
<p><span class="user-mention" data-user-id="138938">@Jethro</span> just to be sure, could you try compiling this with <code>build/x86_64-unknown-linux-gnu/stage0/bin/rustc</code>?</p>
<div class="codehilite"><pre><span></span><span class="k">pub</span><span class="w"> </span><span class="k">static</span><span class="w"> </span><span class="n">TEST</span>: <span class="nb">Option</span><span class="o">&lt;</span><span class="k">fn</span><span class="p">()</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">main</span><span class="p">);</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</pre></div>



<a name="148121395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121395">(Nov 21 2018 at 16:32)</a>:</h4>
<p>Maybe just</p>
<blockquote>
<p>Send a PR to the master branch to:</p>
<ul>
<li>modify src/stage0.txt to bootstrap from yesterday’s beta</li>
<li>modify src/bootstrap/channel.rs with the new version number</li>
</ul>
</blockquote>



<a name="148121402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121402">(Nov 21 2018 at 16:32)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> that works, but the example I just posted doesn't (it produces the same error I was seeing)</p>
<div class="codehilite"><pre><span></span>fn a() {} struct A&lt;T&gt;(Option&lt;fn() -&gt; T&gt;); const X: A&lt;()&gt; = A(Some(a));
</pre></div>



<a name="148121404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121404">(Nov 21 2018 at 16:32)</a>:</h4>
<p><span class="user-mention" data-user-id="116155">@Jake Goulding</span> yeah that looks good</p>



<a name="148121589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121589">(Nov 21 2018 at 16:35)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@Oli</span>  <span class="user-mention" data-user-id="120791">@RalfJ</span>  do you know which PR fixed this? I can't quite identify it in the beta commit log</p>



<a name="148121763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121763">(Nov 21 2018 at 16:38)</a>:</h4>
<p>maybe <a href="https://github.com/rust-lang/rust/pull/55474" target="_blank" title="https://github.com/rust-lang/rust/pull/55474">https://github.com/rust-lang/rust/pull/55474</a> ?</p>



<a name="148121841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148121841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148121841">(Nov 21 2018 at 16:39)</a>:</h4>
<p>looks like the one</p>



<a name="148122618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148122618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148122618">(Nov 21 2018 at 16:50)</a>:</h4>
<p>oh, so it wasn't even about fn pointers</p>



<a name="148122621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148122621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148122621">(Nov 21 2018 at 16:50)</a>:</h4>
<p>that explains it</p>



<a name="148122653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148122653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148122653">(Nov 21 2018 at 16:50)</a>:</h4>
<p>yeah then <span class="user-mention" data-user-id="138938">@Jethro</span> try getting the bootstrap compiler updated. I am afraid I have no idea how to do that.<br>
Cc <span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="116015">@Alex Crichton</span> <span class="user-mention" data-user-id="119009">@eddyb</span></p>



<a name="148122662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148122662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148122662">(Nov 21 2018 at 16:51)</a>:</h4>
<p>I already found out!</p>



<a name="148122669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148122669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148122669">(Nov 21 2018 at 16:51)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/56139" target="_blank" title="https://github.com/rust-lang/rust/pull/56139">https://github.com/rust-lang/rust/pull/56139</a></p>



<a name="148123049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/fn%20ptr%20in%20static/near/148123049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/fn.20ptr.20in.20static.html#148123049">(Nov 21 2018 at 16:56)</a>:</h4>
<p>awesome :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>